#ifndef OBJLOADER_H
#define OBJLOADER_H

#include <fstream>
#include "modeldata.h"

class ObjLoader
{
public:
	ObjLoader(void);
	~ObjLoader(void);
	bool LoadObjFile(const std::string& fileName);
	void Store(const std::string& fileName);

private:
	bool LoadMTLFile(const std::string& fileName);
	void Unitize();
	void RotateXAxis(const double angle);
	void RotateYAxis(const double angle);
	void RotateZAxis(const double angle);
	void Clear();
	short findMatIndex(const std::string& name);
	void calcTangent(Triangle& triangle);

private:
	std::vector<Point> vertices;
	std::vector<Point> normals;
	std::vector<Point> texCoords;
	std::vector<Material> materials;
	std::vector<std::string> materialNames;
	std::vector<Mesh> meshes;
};

#endif // OBJLOADER_H
